home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-01 / tcoop10a.zip / DEMO.ZIP / TESTMS.CPP < prev    next >
C/C++ Source or Header  |  1991-11-20  |  957b  |  54 lines

  1. //
  2. //      TESTMS.CPP
  3. //      version 1.00    11/15/91
  4. //      test file for Mouse Class
  5. //      copyright (c) 1991 by James S. Clark
  6. //      all rights reserved
  7. //
  8.  
  9. #pragma inline
  10.  
  11. #include <stdio.h>
  12.  
  13. #include "mouse.hpp"
  14.  
  15.  
  16. static void interrupthandler()
  17. {
  18.     static int unsigned     func, newx, newy;
  19. //    static Event        event;
  20.  
  21.     asm   mov    bp, DGROUP    // correct the data segment
  22.     asm   mov    ds, bp
  23.  
  24.     func = _AX;            // save the current position
  25.     newx = _CX;
  26.     newy = _DX;
  27.  
  28. //    event.time = biostime(0);    // save the event data
  29. //    event.x    = newx;
  30. //    event.y    = newy;
  31. //    event.func = func;
  32.  
  33.     // add the event to the event queue
  34.     // and exit
  35.  
  36.     puts("mouse handler called!");
  37. } // interrupthandler
  38.  
  39.  
  40.  
  41. main()
  42. {
  43.     Mouse    mouse;
  44.     int    x, y, button = 0;
  45.  
  46.     if (mouse.active) {
  47.         mouse.usertask(0x03, (function) interrupthandler);
  48.         mouse.show();
  49.         while (button == 0) button = mouse.getstate(&x, &y);
  50.         mouse.hide();
  51.     }
  52. }
  53.  
  54.